UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y8qdFpDaEK0R9hyEaQpot3dA+CxMe6FebhXSR4+l2bg='
WHERE
key_id = 'b7de66df7775de469bd00f3957a9b7dc683fac55dc537e0b3e1fb9fe2d88adb1'
AND (
token = 'Y8qdFpDaEK0R9hyEaQpot3dA+CxMe6FebhXSR4+l2bg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)