UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xOzpqIwek+9+bnXy/OmAvI3qpi7M5RIQmLA5JS9Y/YE=' 
WHERE 
  key_id = '1887d4b8d9fd18370d14fbab6344ba2da22f561eedbb20a8399dfff8ddb66246' 
  AND (
    token = 'xOzpqIwek+9+bnXy/OmAvI3qpi7M5RIQmLA5JS9Y/YE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062