UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I9Ze1ZedNiZ2+eMXgk56DqI9Hs042GSjES9peFOv1OI='
WHERE
key_id = 'd9e6ae6258f4b8d802b72ba7973c36d4c56c2affc5e53c7dcd697cd499775160'
AND (
token = 'I9Ze1ZedNiZ2+eMXgk56DqI9Hs042GSjES9peFOv1OI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)