UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'paPPZFzsdVx23cAgYAHbTCpI3Gi77VtikSXNLwekdAg='
WHERE
key_id = '8b17a9b42993df4c3d59bacd22750c8fd8a88f932702b255d5d8b26500d58107'
AND (
token = 'paPPZFzsdVx23cAgYAHbTCpI3Gi77VtikSXNLwekdAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)