UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kqnF55UUsjh2fJ1gYg19k9J1/9BUQAhySUPNSIgdxJM=' 
WHERE 
  key_id = 'd340165725feb52df07a475026d21f1d4b139c69813db111dc07999435f55e42' 
  AND (
    token = 'kqnF55UUsjh2fJ1gYg19k9J1/9BUQAhySUPNSIgdxJM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049