UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XPj2+CEwxX0m2dcCQYi0fnEMMbZGg9AYmvbE9gIklMo='
WHERE
key_id = 'd7902ea53242f0412b4a31953e8c2ec77ed431b01ae6959803f7d96a78c66320'
AND (
token = 'XPj2+CEwxX0m2dcCQYi0fnEMMbZGg9AYmvbE9gIklMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)