UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Au6WZPMiw8VMt+b+NLpDjVlY+MJ4FiyL1YzwUKdNqPc=' 
WHERE 
  key_id = 'a241c8e89310181e7fb54e06befa4374d44aa511cb634bd379165582294eed15' 
  AND (
    token = 'Au6WZPMiw8VMt+b+NLpDjVlY+MJ4FiyL1YzwUKdNqPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046