UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'siP1mPQmpHaSfF08TIeSlv9/gSYDn8fFrn30n7Glkk0='
WHERE
key_id = 'ee117f83ec0036f65feb044b27ce63eb795c8f9b5a6b5820a5d970b06085521e'
AND (
token = 'siP1mPQmpHaSfF08TIeSlv9/gSYDn8fFrn30n7Glkk0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)