UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G5nL8eKeNnfKAWky7cZ551oGFqlra9Y1EoYFJQzBQLs='
WHERE
key_id = 'be2644fb0e74067b596ce8722d359e47a6c44a134f6ed0e6bba8bb4b970b07cd'
AND (
token = 'G5nL8eKeNnfKAWky7cZ551oGFqlra9Y1EoYFJQzBQLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)