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