UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rC7AtCxYCQ6rXVgyiJAYGrQz5bY4iKhTJFeCzGlx5cM='
WHERE
key_id = 'e6ea12160f7ed445d05234aaa934c8da03aa6da74b63ccbfd8b36068068daf82'
AND (
token = 'rC7AtCxYCQ6rXVgyiJAYGrQz5bY4iKhTJFeCzGlx5cM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)