UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TZJCyE4sOyY9PemChWC4UORSlkRgaq/XgL+zqJmGEws='
WHERE
key_id = 'e0b23958c1a866e6492f810ab3ea458cc7ae128edda3d21455e78d1f37f144a8'
AND (
token = 'TZJCyE4sOyY9PemChWC4UORSlkRgaq/XgL+zqJmGEws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)