UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uh504+RpM1TcQ+OxdAS/nMZRNP3uy9BqUstryBy/6UU=' 
WHERE 
  key_id = 'e1370216636881243edf2825142a18dee2822e2154069c5d465045a280bcbc2d' 
  AND (
    token = 'uh504+RpM1TcQ+OxdAS/nMZRNP3uy9BqUstryBy/6UU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036