UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dMa0qKwdYvaNj/zMYqGXJh+sH0fRb3JI7vpZYrU68Rk='
WHERE
key_id = '182c84d0bfb61211a2711f8973d50164499f1430ca5a40d068436a9c3b4b1cf0'
AND (
token = 'dMa0qKwdYvaNj/zMYqGXJh+sH0fRb3JI7vpZYrU68Rk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)