UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M6evIRXCStD66oeA4TUkXGIhJgh86jrjvTz1gMGpP+0='
WHERE
key_id = 'bdf9995beb1e4a239726e66e738e425ff41a74c1f57382e502476a7dad509464'
AND (
token = 'M6evIRXCStD66oeA4TUkXGIhJgh86jrjvTz1gMGpP+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)