UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gePZT9ymQa4cw8jKjObHYqAbIHuzhBQnnz2fNUkiqOQ=' 
WHERE 
  key_id = '9cc978ecbb0f5edd34cb97cd2e97563a133a40544fe589ddce206900c408b7a0' 
  AND (
    token = 'gePZT9ymQa4cw8jKjObHYqAbIHuzhBQnnz2fNUkiqOQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035