UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EdkmCz/wXqRoNgAFE9hSB5RaWuiMtgCA/m3O5F2OOXA='
WHERE
key_id = 'a2b56e1f4217b386ff476a5b208a333f014a3fd3569deed6dd4b8b9500166e12'
AND (
token = 'EdkmCz/wXqRoNgAFE9hSB5RaWuiMtgCA/m3O5F2OOXA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)