UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1WwrgzU4tCrQFgJdsBb5P5CK0i1tjrHceTRK4/n23jk=' 
WHERE 
  key_id = '3908f622d5403daba3ddaa459f2f5f75826d4603a9d9463f457085cc167624be' 
  AND (
    token = '1WwrgzU4tCrQFgJdsBb5P5CK0i1tjrHceTRK4/n23jk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033