UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mBFGSRTMDbbvrRt9YRNpOU0568Y9qyNR/xbqiZXzRdk=' 
WHERE 
  key_id = '69bcba09c2867c9680bde6184817183044b926a23b91a23b5009b85d09dbf3de' 
  AND (
    token = 'mBFGSRTMDbbvrRt9YRNpOU0568Y9qyNR/xbqiZXzRdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054