UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0JpOvGTJmFdqR5fHZZ6kaDi9sZA9yglDLiydB9jlPCw='
WHERE
key_id = 'b15c41974d5a72c3f502d2566a6454df943471b7ec74dcaddc5c68e0055768ad'
AND (
token = '0JpOvGTJmFdqR5fHZZ6kaDi9sZA9yglDLiydB9jlPCw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)