UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gnCGiTcNOPqY4so+8Ycpauy/2XfzwWR0xY4e/uvWTjs='
WHERE
key_id = '9f848b4348047c9713bb49902933639566693d910c3af5f74c785bbc68dd2187'
AND (
token = 'gnCGiTcNOPqY4so+8Ycpauy/2XfzwWR0xY4e/uvWTjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)