UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'le+SKAvRkG0jJz3pVl0GIixiW2kNrAorbXSzboDRv+4='
WHERE
key_id = 'cdea716ad436a3d9867eb000c3a481b5c5688873483c318d90f31112f867b11b'
AND (
token = 'le+SKAvRkG0jJz3pVl0GIixiW2kNrAorbXSzboDRv+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)