UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k+/wSNSYg8zEJ1oEl1UrO4caVQwLpRMmJKiPhnHGqW8=' 
WHERE 
  key_id = '6d85f99528cb0167aef706b807889b01fe0f88f40f2d9c9cfc17c474943e0873' 
  AND (
    token = 'k+/wSNSYg8zEJ1oEl1UrO4caVQwLpRMmJKiPhnHGqW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037