UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CN9FrPpbmcYzAzFfN2KwCR/MtP0QQtH+heEeYhr+CMw='
WHERE
key_id = 'cdc665f20ade8c52cb93ac2d8444c103f26ff6382de047657abf518328a05dc6'
AND (
token = 'CN9FrPpbmcYzAzFfN2KwCR/MtP0QQtH+heEeYhr+CMw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)