UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7jRB5M+MbUKFvTpRWz97GXI4/U750vhtDbrpKIv2sx4='
WHERE
key_id = '52176ea9ce9a0e0a031d7afa373935e4d6a90d0df4475e1a9c9a7c6c52edba0a'
AND (
token = '7jRB5M+MbUKFvTpRWz97GXI4/U750vhtDbrpKIv2sx4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)