UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cpe7S78Ul+neptsOoHIxA49t15AjcI/83ZuIb2+Nom4='
WHERE
key_id = '17d28b1bcec22b0789f10e3db73e6fe2642ac37357bfefa7859616ff12990cdc'
AND (
token = 'Cpe7S78Ul+neptsOoHIxA49t15AjcI/83ZuIb2+Nom4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)