UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MiVHwQU644uhCwx7uwGOuXfImJXj1siLrYWSQ0AmDcQ=' 
WHERE 
  key_id = 'd6cfb8b8441ef4d7f2e38d23a37c313c535d6bb5246356b333d6a1d0642b032c' 
  AND (
    token = 'MiVHwQU644uhCwx7uwGOuXfImJXj1siLrYWSQ0AmDcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047