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