UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EOwWXTZTwtml4DrMN3XK1P8hXl355AivphHZCR8o1YI=' 
WHERE 
  key_id = '24c3b4d7ae87e6127a9f98e5d8e84238e927b78d5ec9f9260ec13b3b2501ef0c' 
  AND (
    token = 'EOwWXTZTwtml4DrMN3XK1P8hXl355AivphHZCR8o1YI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026