UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w5t0kvIAHEasWc4Mh60eiIUvi83wl4yXXvALIzqHf8g='
WHERE
key_id = '21a0218bcdfba1d80ef3c44bdaad9c3d5eac17c5890c19f85a0a76ddb0317aed'
AND (
token = 'w5t0kvIAHEasWc4Mh60eiIUvi83wl4yXXvALIzqHf8g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)