UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'caaPiY7LsHT6ky59DPdy6xCh84xgCbUnEpfxZ/JOuxU=' 
WHERE 
  key_id = '6014ebe8f6e4a73f5a314182e791501cf94c658f9ae20febbcc8f13a915f474b' 
  AND (
    token = 'caaPiY7LsHT6ky59DPdy6xCh84xgCbUnEpfxZ/JOuxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026