UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LIhl/wuA7jB93iKVrUOGZBOHWGshucb1huaIPABF5qA=' 
WHERE 
  key_id = '4bcf519249ac43ac63b30ead615bd6a299dfb4c23fdecb9921086133b2537bf9' 
  AND (
    token = 'LIhl/wuA7jB93iKVrUOGZBOHWGshucb1huaIPABF5qA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024