UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3A2xvTAo1gQMAmltU1cbX2OwL+wSsyRWoD2r4jSa8E8='
WHERE
key_id = 'a79b896079d62455369c20e82f16f0bf9c41c8270d437058dcb980864efd2f57'
AND (
token = '3A2xvTAo1gQMAmltU1cbX2OwL+wSsyRWoD2r4jSa8E8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)