UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dnFddd9dLlg5GaZl1feArvfvsGli/k+DvU5lroHHaUs=' 
WHERE 
  key_id = '67f8b3b91af124176e90578fed6c4627a90d9ad5b6b40883144e46cc4bd53a54' 
  AND (
    token = 'dnFddd9dLlg5GaZl1feArvfvsGli/k+DvU5lroHHaUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050