UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l2bYU79xH9OWSwLtDqj2+T5/yMxMJ9m0VlVyT6nGuDo=' 
WHERE 
  key_id = '57758c61e41442123cd8f51ac3dec023fe5faa38f7f76312944124deece91b88' 
  AND (
    token = 'l2bYU79xH9OWSwLtDqj2+T5/yMxMJ9m0VlVyT6nGuDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031