UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nLcCymNfKQ2hDZy1OyAlgBNKRdmZqdIhfv547+bz4t4='
WHERE
key_id = 'e2603e3a4abd351e4794fe6f000da47619f7230268e95025ba894fc889adb5d2'
AND (
token = 'nLcCymNfKQ2hDZy1OyAlgBNKRdmZqdIhfv547+bz4t4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)