UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gB9RGcqyS9KosO9HZByaKCT/vdTkDe/XcUEvG95ryn8='
WHERE
key_id = '6c71cea1a7f2bf310620ec62300b6cfc84b9d4b6c50deb2d9685f79a7c93734f'
AND (
token = 'gB9RGcqyS9KosO9HZByaKCT/vdTkDe/XcUEvG95ryn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)