UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YR+HSjfb+b/b0Z1s4pP6FxOqAp7RdinHNgQN1dJ2EiY=' 
WHERE 
  key_id = '378f98f67580b6dbb703202f21bb03d7b49b94744dbe008b4ce5406e7f8f7aa6' 
  AND (
    token = 'YR+HSjfb+b/b0Z1s4pP6FxOqAp7RdinHNgQN1dJ2EiY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031