UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Pa7QePUkkQGNORH++6GPsGaLIA9cQrwkthDf0WZd0Ts='
WHERE
key_id = 'a210d75bd1dc41eb7ae7b9cd4b80e73e96c3565d4afed97b4e24efbfb743b9a9'
AND (
token = 'Pa7QePUkkQGNORH++6GPsGaLIA9cQrwkthDf0WZd0Ts='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)