UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pGhIXmxBqORg9tc7ot4Vm31Mi00uK0RUk7kXbEiGkQY=' 
WHERE 
  key_id = '4f1fdd12536c804960b1b02069528806168e65cebcb25bbb3e5312be44cec6ae' 
  AND (
    token = 'pGhIXmxBqORg9tc7ot4Vm31Mi00uK0RUk7kXbEiGkQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030