UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DI+xpDiH2I56xh5tZKHiqR5rnJkj1HBfema/ikD4FoI=' 
WHERE 
  key_id = 'f9074ecdc7998ce0eeeec3f3ba6ad21ae46333429f59f90e08b480c2f8471cca' 
  AND (
    token = 'DI+xpDiH2I56xh5tZKHiqR5rnJkj1HBfema/ikD4FoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030