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