UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QkLkBovDxEhUs1XBQCjpYei1NxBFJombJ9huqclTwy0=' 
WHERE 
  key_id = '3bd951476cf186821fbf86d35d7f5a159902d71427c05138e8e7058898a2dd43' 
  AND (
    token = 'QkLkBovDxEhUs1XBQCjpYei1NxBFJombJ9huqclTwy0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047