UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ys3aDrkoyNqvPUWMVh2w1gmnqf7VaiGIwjp0DyUaFUo=' 
WHERE 
  key_id = 'f085d77c6ed76ad3dae906c5197415e1b3568445afa7f906a734f9c2691d5e94' 
  AND (
    token = 'ys3aDrkoyNqvPUWMVh2w1gmnqf7VaiGIwjp0DyUaFUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046