UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P6rW209tdD+6k1KbAuZ8H8XXQukzGT6SBffVZDj9H/0='
WHERE
key_id = 'e0e8601008ca3db5859cf1695b98a19b1af679d134767919cb768bb23234eb70'
AND (
token = 'P6rW209tdD+6k1KbAuZ8H8XXQukzGT6SBffVZDj9H/0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)