UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'szrAMXpO9jDROloFoMV1j30OJCFBBH+hlcksB1iLa8Q=' 
WHERE 
  key_id = '144bf69b05ce0503b297ec0674d0a35d563f73982cf879c726f1440e1bea5eb4' 
  AND (
    token = 'szrAMXpO9jDROloFoMV1j30OJCFBBH+hlcksB1iLa8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029