UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jQ90r5+LlGY6uv2Rswl3NCIHzKDfz1zu5ymymZ6mGmw='
WHERE
key_id = '9ca08d47078d4cd1fd6467ddd0dbc183d0447d8f1648f98f380295b934b7cb03'
AND (
token = 'jQ90r5+LlGY6uv2Rswl3NCIHzKDfz1zu5ymymZ6mGmw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)